/*
 * @Author: Setsuna
 * @Email: setsuna.xyz@qq.com
 * @FilePath: \src\pages\TodoList\StockCheck\Detail\terminalTable.tsx
 * @Date: 2022-12-05 10:44:43
 * @LastEditTime: 2023-02-20 16:16:22
 * @LastEditors: Setsuna
 */
import React from 'react'
import { UdTable, IUdColumn } from '@/lib'
import { Tooltip } from 'antd'

function TerminalTable(props: ITerminalTableProps) {
  const { dataSource } = props
  const columns: IUdColumn[] = [
    { title: '物料描述', dataIndex: 'matName' },
    { title: '物料号', dataIndex: 'prodBarcode' },
    { title: '期初实际库存/件', dataIndex: 'beginningRealStock' },
    { title: '期间开单/件', dataIndex: 'nowAog' },
    { title: '调入调出/件', dataIndex: 'allocateNumber' },
    { title: '当前实物库存/件', dataIndex: 'nowRealStock' },
    { title: '当前未到货/件', dataIndex: 'onOrder' },
    { title: '动销数/件', dataIndex: 'nowMove' },
    { title: '下月订单计划/件', dataIndex: 'nextMonthOrderNum' },
    {
      title: '动销说明',
      dataIndex: 'nowMoveDes',
      key: 'nowMoveDes',
      width: 130,
      render: (text, record) => {
        return (
          <Tooltip title={record.nowMoveDes}>
            <div style={{ width: '130px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>
              {record.nowMoveDes}
            </div>
          </Tooltip>
        )
      },
    },
    {
      title: '备注',
      dataIndex: 'remark',
      key: 'remark',
      width: 130,
      render: (text, record) => {
        return (
          <Tooltip title={record.remark}>
            <div style={{ width: '130px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>
              {record.remark}
            </div>
          </Tooltip>
        )
      },
    },
  ]
  return <UdTable rowKey="id" dataSource={dataSource} columns={columns} pagination={false} />
}

export default React.memo(TerminalTable)

interface ITerminalTableProps {
  dataSource: any[]
}
